<?php
abstract class controller{
	public $path = "";
	//public $path = "http://marketingman.hu/";
	public $url;
	public $database;

	public function __construct($url){
		/*if(!isset($_GET["show"])){
			print "<!doctype html><p>Az oldal fejleszt&eacute;s alatt &aacute;ll!</p>";
			exit;
		}*/
		$this->url = $url;
		$this->database = new database("localhost", "root", "", "marketin_honlap");
		//$this->database = new database("localhost", "marketin_user", "Marketing123", "marketin_honlap");
	}

	public function redirect($to, $message=null){
		if($message!=null) $_SESSION["message"] = $message;
		header("Location: index.php?url=".$to);
	}

	public function createMenu(){
		return $this->database->createMenu("index.php?url=");
	}

	public function start(){
		$this->run();
		$this->startGui();
	}

	public abstract function run();

	public function startGui(){
		$gui = new gui($this);
		$gui->show();
	}
}
?>